package edu.tyut.game.logic

import edu.tyut.game.logic.Repository.fire
import edu.tyut.game.logic.model.Feedback
import edu.tyut.game.logic.network.GameNetWork
import edu.tyut.game.utils.LogUtils

object FeedbackRepository {

    private val tag = this::class.java.name

    fun sendFeedback(feedback: Feedback) = fire {
        LogUtils.d(tag, feedback.toString())
        val res = GameNetWork.sendFeedback(feedback)
        if (res.status == "ok"){
            Result.success(res.data)
        }else{
            LogUtils.d(tag, res.msg)
            Result.failure(Exception(res.data))
        }
    }
}